//
// Created by Nasa on 2023/2/19.
//去重复
// 按月取不同的日期(考虑闰年)
//

#include <iostream>
#include "isLeapYear.h"

using namespace std;

int main()
{
    int a, b, c, cf = 0;
    int days[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    scanf("%d %d %d", &a, &b, &c);
    if (a == b and b == c)
    {
        cf = 1;
    }
    // yy-mm-dd
    if (b<13 and b>0)
    {
        if (b == 2) // 只在输入为2月时判断是否闰年
        {
            if (a > 59)
            {
                if (isLeapYear(a + 1900))
                {
                    days[2] = 29;
                }
            } else if (a <= 59)
            {
                if (isLeapYear(a + 2000))
                {
                    days[2] = 29;
                }
            }
        }
        if (c>0 and c < days[b] + 1)
        {
            if (a > 59)
            {
                printf("yy-mm-dd: %d %02d %02d\n", a + 1900, b, c);
            }
            if (a <= 59)
            {
                printf("yy-mm-dd: %d %02d %02d\n", a + 2000, b, c);
            }
        }
    }
    days[2] = 28;
    // mm-dd-yy
    if (a < 13 and a > 0 and cf == 0)
    {
        if (a == 2)
        {
            if (c > 59)
            {
//                2 29 15
                if (isLeapYear(c + 1900))
                {
                    days[2] = 29;
                }
            } else if (c <= 59)
            {
                if (isLeapYear(c + 2000))
                {
                    days[2] = 29;
                }
            }
        }
        if (b < days[a] + 1 and b > 0)
        {
            if (c > 59)
            {
                printf("mm-dd-yy: %02d %02d %d\n", a, b, c + 1900);
            }
            if (c <= 59)
            {
                printf("mm-dd-yy: %02d %02d %d\n", a, b, c + 2000);
            }
        }
    }
    days[2] = 28;
    // dd-mm-yy
    if (b < 13 and b > 0 and cf == 0)
    {
        if (b == 2)
        {
            if (c > 59)
            {
                if (isLeapYear(c + 1900))
                {
                    days[2] = 29;
                }
            } else if (c <= 59)
            {
                if (isLeapYear(c + 2000))
                {
                    days[2] = 29;
                }
            }
        }
        if (a < days[b] + 1 and a > 0)
        {
            if (c > 59)
            {
                printf("dd-mm-yy: %02d %02d %d\n", a, b, c + 1900);
            }
            if (c <= 59)
            {
                printf("dd-mm-yy: %02d %02d %d\n", a, b, c + 2000);
            }
        }
    }
}